		<?php $this->load->view('layout/lib_chart');?>
		
		<?php
		$data	=	array(0 => array(0,0)); 
		foreach($rows as $k => $row){ 
			$temp[0]	=	floatval($row["years_to_go"]);
			$tt = 0;
			for($i=0; $i<=$k; $i++){
				$tt	+=	floatval($rows[$i]["amount_to_save"]);
			}
			$temp[1]	=	$tt;
			$data[]		=	$temp;
		}
		$data	=	json_encode($data);
		#print_r($data);
		?>
		<script type="text/javascript">

			var chart1,chart2,chart3,chart4;
			$(document).ready(function() {
				chart1 = new Highcharts.Chart({
					chart: {
						renderTo: 'chart',
						defaultSeriesType: 'line',
						//inverted: true,
						width: 500,
						style: {
							//margin: '0 auto'
						}
					},
					title: {
						text: 'Savings'
					},
					subtitle: {
						//text: 'According to the Standard Atmosphere Model'
					},
					xAxis: {
						reversed: false,
						title: {
							enabled: true,
							text: 'Year',
							align : 'high'
						},
						labels: {
							formatter: function() {
								return this.value +'';
							}
						},
						maxPadding: 0.05,
						//showLastLabel: true,
						min : 0,
						gridLineWidth : 1
					},
					yAxis: {
						title: {
							text: 'S$',
							align : 'high',
							rotation : 0
						},
						labels: {
							formatter: function() {
								return this.value + '';
							}
						},
						lineWidth: 2,
						min : 0,
						tickWidth:1,
						gridLineDashStyle:'ShortDash',
						minorGridLineDashStyle: 'Solid',
						minorGridLineWidth: 1
						
					},
					legend: {
						enabled: false
					},
					tooltip: {
						formatter: function() {
							return ''+
								this.y +'$ / '+ this.x +'';
						}
					},
					plotOptions: {
						spline: {
							marker: {
								enable: false
							}
						}
					},
					series: [{
						name: 'Temperature',
						data: <?php echo $data;?>
					}]
				});

				
				
			});
				
		</script>
		<!-- 3. Add the container -->
		<div>
		
		</div>
		<table>
			<tr>
				<td><div id="chart" style="width: 800px; height: 400px; margin: 0 auto"></div></td>
			</tr>
		</table>
		